import { request } from '@/utils/request'

const priorityApi = {
  getAll: (module_type: string) => {
    return request.get(`/priorities/`, { params: { module_type } })
  },
  create: (data: any) => {
    return request.post('/priorities/', data)
  },
  update: (id: string, data: any) => {
    return request.put(`/priorities/${id}`, data)
  },
  delete: (id: string) => {
    return request.delete(`/priorities/${id}`)
  },
  initialize: (module_type: string) => {
    return request.post('/priorities/initialize', null, { params: { module_type } })
  },
  refreshCache: (module_type?: string) => {
    return request.post('/priorities/cache/refresh', null, { 
      params: module_type ? { module_type } : undefined 
    })
  }
}

export { priorityApi }
